home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 2004 #9
/
Amiga Plus CD - 2004 - No. 09.iso
/
amigaplus
/
tools
/
amigaos4_only
/
ifxlite
/
imagefx3
/
rexx
/
analyzejpeg.ifx
next >
Wrap
Text File
|
2004-08-03
|
3KB
|
224 lines
/*
* $VER: AnalyzeJPEG 2.0.0 (22.7.94)
*
* Arexx program for the ImageFX image processing system.
* Written by Thomas Krehbiel
*
* Revised for ImageFX release 2.0.
*
* Analyze the compression vs. quality loss of JPEG on the image
* in the current buffer; draw a graph of the results into the
* swap buffer.
*
*/
OPTIONS RESULTS
CALL ADDLIB('rexxsupport.library',0,-30,0)
startq = 25
endq = 100
GetMain
IF result = "" THEN DO
/* 2.0: if no main buffer, ask for one */
LoadBuffer
IF rc ~= 0 THEN EXIT
GetMain
END
PARSE VAR result name width height depth .
LockInput
SetPrefs SaveNails Off
prevnails = result
maxbytes = 0
/*
* Collect data
*/
DO i = startq TO endq BY 5
Message 'JPEG Quality =' i
SaveBufferAs JPEG 'RAM:Temp.JPG' i
Swap
LoadBuffer 'RAM:Temp.JPG' NoSmooth
Swap
Subtract
Hook 'Variance'
IF rc ~= 0 THEN EXIT
PARSE VAR result vr.i vg.i vb.i
vr.i = (vr.i + 50) % 100
vg.i = (vg.i + 50) % 100
vb.i = (vb.i + 50) % 100
avg.i = (vr.i + vg.i + vb.i) % 3
f = STATEF('RAM:Temp.JPG')
bytes.i = WORD(f,2)
IF bytes.i > maxbytes THEN maxbytes = bytes.i
Undo
END
ADDRESS COMMAND 'Delete >NIL: RAM:Temp.JPG'
/*
* Now make a nifty-neato graph to show the data
*/
Swap
Redraw Off ; Undo Off
CreateBuffer 640 400 Force
KillBrush
/*
* Fill in block of graph
*/
Blend 50
SetPalette '-1' 255 0 0
NewArea
AddArea (startq-22)*8 390
DO i = startq TO endq BY 5
AddArea (i-22)*8 390-vr.i
END
AddArea (endq-22)*8 390
FilledPoly
SetPalette '-1' 0 255 0
NewArea
AddArea (startq-22)*8 390
DO i = startq TO endq BY 5
AddArea (i-22)*8 390-vg.i
END
AddArea (endq-22)*8 390
FilledPoly
SetPalette '-1' 0 0 255
NewArea
AddArea (startq-22)*8 390
DO i = startq TO endq BY 5
AddArea (i-22)*8 390-vb.i
END
AddArea (endq-22)*8 390
FilledPoly
SetPalette '-1' 96 96 96
NewArea
AddArea (startq-22)*8 390
DO i = startq TO endq BY 5
AddArea (i-22)*8 390-avg.i
END
AddArea (endq-22)*8 390
FilledPoly
/*
* Line graph
*/
Blend 100
SetPalette '-1' 255 0 0
NewArea
DO i = startq TO endq BY 5
AddArea (i-22)*8 390-vr.i
END
FreeLine
SetPalette '-1' 0 255 0
NewArea
DO i = startq TO endq BY 5
AddArea (i-22)*8 390-vg.i
END
FreeLine
SetPalette '-1' 0 0 255
NewArea
DO i = startq TO endq BY 5
AddArea (i-22)*8 390-vb.i
END
FreeLine
SetPalette '-1' 192 192 192
NewArea
DO i = startq TO endq BY 5
AddArea (i-22)*8 390-avg.i
END
FreeLine
/*
* Line graph of file sizes
*/
Blend 100
SetPalette '-1' 255 255 255
NewArea
DO i = startq TO endq BY 5
height = 380 * bytes.i / maxbytes
AddArea (i-22)*8 390-height
END
FreeLine
/*
* Graph Labels
*/
Blend 100
LockGui
SetPalette '-1' 150 150 150
DO i = startq TO endq BY 5
Text topaz.font 8 100 i
BrushHandle YOFFSET 0
Point (i-22)*8 391
END
SetPalette '-1' 255 255 0
Text topaz.font 8 100 name
BrushHandle 0 0
Point 10 10
SetPalette '-1' 255 255 255
Text topaz.font 8 100 'File Size'
BrushHandle 0 0
Point 30 20
KillBrush
Line 10 25 25 25
SetPalette '-1' 255 0 0
Text topaz.font 8 100 'Red Variance'
BrushHandle 0 0
Point 30 30
KillBrush
Line 10 35 25 35
SetPalette '-1' 0 255 0
Text topaz.font 8 100 'Green Variance'
BrushHandle 0 0
Point 30 40
KillBrush
Line 10 45 25 45
SetPalette '-1' 0 0 255
Text topaz.font 8 100 'Blue Variance'
BrushHandle 0 0
Point 30 50
KillBrush
Line 10 55 25 55
UnlockGui
Undo On ; Redraw On ; Redraw
SetPrefs SaveNails prevnails
UnlockInput
EXIT